<template>
  <MainFrame>
    <div slot='content'>
      <div class="top-title">
        台区实时数据
      </div>
      <div style="margin: 10px 0;">
        <el-button type="primary" @click="back" icon="el-icon-back" style="margin-left: 20px;">返回</el-button>
      </div>
      <div class="page">
        <el-table :data="items" border style="width: 100%" stripe>
          <!-- <el-table-column prop="id" label="id" width="100">
          </el-table-column> -->
          <el-table-column prop="lassUpdateTime" label="时间" width="160">
          </el-table-column>
          <el-table-column prop="location" label="归属地" width="70">
          </el-table-column>
          <el-table-column prop="areaNo" label="台区号" width="70">
          </el-table-column>
          <el-table-column prop="Ia" label="Ia" width="75">
            <template slot-scope="scope">
              {{ scope.row.Ia ? scope.row.Ia : 0 }}A
            </template>
          </el-table-column>
          <el-table-column prop="Ib" label="Ib" width="75">
            <template slot-scope="scope">
              {{ scope.row.Ib ? scope.row.Ib : 0 }}A
            </template>
          </el-table-column>
          <el-table-column prop="Ic" label="Ic" width="75">
            <template slot-scope="scope">
              {{ scope.row.Ic ? scope.row.Ic : 0 }}A
            </template>
          </el-table-column>
          <el-table-column prop="In" label="In" width="75">
            <template slot-scope="scope">
              {{ scope.row.In ? scope.row.In : 0 }}A
            </template>
          </el-table-column>
          <el-table-column prop="Ua" label="Ua" width="75">
            <template slot-scope="scope">
              {{ scope.row.Ua ? scope.row.Ua : 0 }}V
            </template>
          </el-table-column>
          <el-table-column prop="Ub" label="Ub" width="75">
            <template slot-scope="scope">
              {{ scope.row.Ub ? scope.row.Ub : 0 }}V
            </template>
          </el-table-column>
          <el-table-column prop="Uc" label="Uc" width="75">
            <template slot-scope="scope">
              {{ scope.row.Uc ? scope.row.Uc : 0 }}V
            </template>
          </el-table-column>
          <el-table-column prop="PFa" label="PFa" width="75">
          </el-table-column>
          <el-table-column prop="PFb" label="PFb" width="75">
          </el-table-column>
          <el-table-column prop="PFc" label="PFc" width="75">
          </el-table-column>
        </el-table>
      </div>
    </div>
  </MainFrame>
</template>
<script>
import MainFrame from '@/components/MainFrame';
import utils from '../ttJs/utils.js'
import { validateData } from '../ttJs/utils.js'
export default {
  components: {
    MainFrame,
  },
  data() {
    return {
      items: [],
      areaId: null,
      id_of_setinterval: 0
    };
  },
  mounted: function() {
    this.areaId = this.$route.query.id;
    this.getItems();
    // this.id_of_setinterval = window.setInterval(this.getItems, 96000);
  },
  beforeDestroy: function() {
    // window.clearInterval(this.id_of_setinterval);
  },
  methods: {
    getItems() {
      var self = this;
      var url = '/yitai/admin/areaData';
      var params = { id: this.areaId };
      var success = function(response) {
        //self.items = response.info;
        self.items = [];
        self.items.push(response.info);
      }
      var fail = function() {}
      var complete = function() {}
      utils.request(url, params, success, fail, complete)
    },
    back() {
      window.history.back();
    }
  }
}

</script>
<style scoped rel="stylesheet/scss" lang="scss">
.top-title {
  font-size: 18px;
  font-weight: bold;
  padding: 0 20px;
}

.page {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

</style>
